package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class TravelCommend extends BaseDomain {

    private Long travelId;

    private String title;
    //副标题
    private String subTitle;
     //封面
    private String coverUrl;
     //推荐的时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date schedule;
     //推荐类型
    private Integer type;

    public String getJson(){
        Map<String,Object> map=new HashMap<>();
        map.put("id", id);
        map.put("title", title);
        map.put("travelId", travelId);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        map.put("schedule",simpleDateFormat.format(schedule));
        map.put("type",type);
        return JSONUtil.toJSONString(map);
    }
}